/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package convert;

import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.inject.Named;
import model.entity.Depot;
import service.InterfaceServiceLocal;

/**
 *求解状态
 * @author dingnangen
 */
@Named("msgStateConvert")
@RequestScoped
public class MsgStateConvert implements Converter {

   
     

    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        //0计算中;1计算完成;2计算失败
        int s = 0;
        switch (value) {
            case " 未读":
                s = 0;
                break;
            case "已读":
                s = 1;
                break;
             
            default:
                break;
        }

        return s;

    }

    @Override
    public String getAsString(FacesContext context, UIComponent component, Object value) {
        String s = "未知";
        switch ((int) value) {
            case 0:
                s = "未读";
                break;
            case 1:
                s = "已读";
                break;
 
            default:
                break;
        }

        return s;

    }

}
